home *** CD-ROM | disk | FTP | other *** search
- package sun.font;
-
- import sun.font.LayoutPathImpl.EndType;
-
- public final class LayoutPathImpl$SegmentPathBuilder {
- private double[] data;
- // $FF: renamed from: w int
- private int field_0;
- // $FF: renamed from: px double
- private double field_1;
- // $FF: renamed from: py double
- private double field_2;
- // $FF: renamed from: a double
- private double field_3;
- private boolean pconnect;
- // $FF: synthetic field
- static final boolean $assertionsDisabled = !LayoutPathImpl.class.desiredAssertionStatus();
-
- public void reset(int var1) {
- if (this.data != null && var1 <= this.data.length) {
- if (var1 == 0) {
- this.data = null;
- }
- } else {
- this.data = new double[var1];
- }
-
- this.field_0 = 0;
- this.field_1 = this.field_2 = (double)0.0F;
- this.pconnect = false;
- }
-
- public LayoutPathImpl.SegmentPath build(LayoutPathImpl.EndType var1, double... var2) {
- if (!$assertionsDisabled && var2.length % 2 != 0) {
- throw new AssertionError();
- } else {
- this.reset(var2.length / 2 * 3);
-
- for(int var3 = 0; var3 < var2.length; var3 += 2) {
- this.nextPoint(var2[var3], var2[var3 + 1], var3 != 0);
- }
-
- return this.complete(var1);
- }
- }
-
- public void moveTo(double var1, double var3) {
- this.nextPoint(var1, var3, false);
- }
-
- public void lineTo(double var1, double var3) {
- this.nextPoint(var1, var3, true);
- }
-
- private void nextPoint(double var1, double var3, boolean var5) {
- if (var1 != this.field_1 || var3 != this.field_2) {
- if (this.field_0 == 0) {
- if (this.data == null) {
- this.data = new double[6];
- }
-
- if (var5) {
- this.field_0 = 3;
- }
- }
-
- if (this.field_0 != 0 && !var5 && !this.pconnect) {
- this.data[this.field_0 - 3] = this.field_1 = var1;
- this.data[this.field_0 - 2] = this.field_2 = var3;
- } else {
- if (this.field_0 == this.data.length) {
- double[] var6 = new double[this.field_0 * 2];
- System.arraycopy(this.data, 0, var6, 0, this.field_0);
- this.data = var6;
- }
-
- if (var5) {
- double var10 = var1 - this.field_1;
- double var8 = var3 - this.field_2;
- this.field_3 += Math.sqrt(var10 * var10 + var8 * var8);
- }
-
- this.data[this.field_0++] = var1;
- this.data[this.field_0++] = var3;
- this.data[this.field_0++] = this.field_3;
- this.field_1 = var1;
- this.field_2 = var3;
- this.pconnect = var5;
- }
- }
- }
-
- public LayoutPathImpl.SegmentPath complete() {
- return this.complete(EndType.EXTENDED);
- }
-
- public LayoutPathImpl.SegmentPath complete(LayoutPathImpl.EndType var1) {
- if (this.data != null && this.field_0 >= 6) {
- LayoutPathImpl.SegmentPath var2;
- if (this.field_0 == this.data.length) {
- var2 = new LayoutPathImpl.SegmentPath(this.data, var1);
- this.reset(0);
- } else {
- double[] var3 = new double[this.field_0];
- System.arraycopy(this.data, 0, var3, 0, this.field_0);
- var2 = new LayoutPathImpl.SegmentPath(var3, var1);
- this.reset(2);
- }
-
- return var2;
- } else {
- return null;
- }
- }
- }
-